package edu.xmut.yuepai.user.contoller;


import edu.xmut.yuepai.common.result.R;
import edu.xmut.yuepai.model.entity.User;
import edu.xmut.yuepai.model.vo.UserInfoVO;
import edu.xmut.yuepai.user.service.UserService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {


    @Resource
    private UserService userService;


    @GetMapping("/{id}")
    public User getById(@PathVariable("id") Long id) {
        return userService.getById(id);
    }

    @GetMapping("/mine")
    public R mine() {
        UserInfoVO userInfoVO = userService.getMyInfo();
        return R.ok(userInfoVO);
    }
}
